<!doctype html>
<html lang="en" ng-app="Estate">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" type="image/x-icon" href="/assets/bitbug_favicon-7.ico" />
    <title>
        <g:layoutTitle default="Some Title" />
    </title>
    <asset:stylesheet src="ztree/demo.css"/>
    <asset:stylesheet src="ztree/zTreeStyle.css/"/>
    <asset:stylesheet src="homer/vendor/animate/animate.css" />
    <asset:stylesheet src="homer/vendor/metisMenu/metisMenu.min.css" />
    <asset:stylesheet src="homer/vendor/bootstrap/dist/css/bootstrap.min.css" />
    <asset:stylesheet src="homer/vendor/bootstrap/dist/css/bootstrap-datepicker3.min.css" />
    <asset:stylesheet src="homer/vendor/toastr/toastr.min.css"/>
    <asset:stylesheet src="homer/style.css" id="skin1"  />
    <asset:stylesheet src="homer/vendor/sweetalert/lib/sweet-alert.css" />
    <asset:stylesheet src="homer/vendor/select2-3.5.2/select2.min.css" />
    <asset:stylesheet src="homer/vendor/select2-3.5.2/select2-bootstrap.css" />
    <asset:stylesheet src="homer/vendor/datetimepicker/bootstrap-datetimepicker.min.css" />
    <asset:stylesheet src="homer/vendor/footable/footable.core.min.css" />
    <asset:stylesheet src="homer/vendor/bootstrap/dist/css/bootstrap-datepicker3.min.css" />
    <asset:javascript src="homer/vendor/jquery/dist/jquery.min.js" />
    <asset:javascript src="angular/angular.min.js" />
    <asset:javascript src="angular/tree/angular-ui-tree.min.js" />
    <asset:javascript src="angular/ui/ui-bootstrap-tpls-2.5.0.min.js" />
    <asset:javascript src="common/moment-with-locales.js" />
    <asset:stylesheet src="homer/vendor/ladda/dist/ladda-themeless.min.css" />

    <script language="JavaScript">
        window.app = angular.module("Estate", ['ui.tree','ui.bootstrap']);
    </script>
    <g:layoutHead/>

    <style type="text/css">
    html {
        height: 100%;
    }

    body {
        font-family: "Microsoft YaHei", "Microsoft Sans Serif", "Helvetica Neue", Helvetica, Arial, "Hiragino Sans GB", sans-serif;
        background-color: #f1f3f6;
    }

    #wrapper {
        margin: 0;
    }

    .table {
        margin-bottom: 0;
    }

    .pagination {
        margin: 0 auto;
        text-align: center;
    }

    .pagination a,
    .pagination .currentStep {
        color: #666;
        display: inline-block;
        margin: 0 0.1em;
        padding: 0.25em 0.7em;
        text-decoration: none;
        -moz-border-radius: 0.3em;
        -webkit-border-radius: 0.3em;
        border-radius: 0.3em;
    }

    .pagination a:hover,
    .pagination a:focus,
    .pagination .currentStep {
        background-color: #999;
        color: #fff;
        outline: none;
        text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8);
    }

    .panel-tools a i {
        margin-right: 4px;
    }

    .panel-heading .panel-tools a.btn {
        color: #fff;
    }

    .errors {
        display: none;
    }

    .errors li {
        padding: 5px 0;
    }

    .form-group span.cont {
        padding-top: 7px;
        margin-bottom: 0;
        display: block;
        font-size: 14px;
        color: #555;
    }

    #side-menu li a i {
        margin-right: 4px;
    }

    #side-menu li a {
        padding: 15px 20px 15px 10px;
    }

    .profile-picture i {
        margin-right: 10px;
    }

    #menu {
        background-color: #fff;
    }

    .new-dropdown {
        min-width: 100px;
    }

    .new-dropdown li i {
        margin-right: 6px;
    }

    .mobile-navbar .navbar-nav > li,
    .mobile-navbar .navbar-nav > li > a {
        height: 36px;
        line-height: 36px;
    }

    .mobile-navbar .navbar-nav > li > a {
        padding: 0 15px;
        font-size: 13px;
    }

    .dropdown-link {
        height: 56px !important;
        line-height: 56px !important;
        padding: 0 20px !important;
        display: block;
    }

    .hpanel {
        margin-bottom: 12px;
    }

    .select2-container .select2-choice {
        color: #999;
        font-size: 14px;
        font-family: inherit;
    }

    .select2-search input {
        font-family: inherit;
    }

    .hr-line-dashed {
        margin: 15px 0;
    }

    .logo {
        padding: 18px;
    }

    .modal textarea,
    .textarea,
    textarea {
        resize: vertical;
    }

    .form-horizontal .control-label {
        padding-top: 8px;
    }

    .nav.navbar-nav li a {
        color: #666;
    }

    .panel-body.active {
        border: none;
    }

    table.text-center th {
        text-align: center;
    }

    .seach-group .col-md-3 {
        margin-bottom: 6px;
    }

    .checkbox input[type="checkbox"] {
        opacity: 1;
    }

    .label {
        padding: .2em .6em .2em;
    }

    .input-group[class*="col-"] {
        float: left;
        padding-right: 15px;
        padding-left: 15px;
    }

    label.is-required:before {
        content: "*";
        color: #e74c3c;
        margin-right: 4px;
        padding-top: 7px;
    }

    .panel-body > .form-group:last-child {
        margin-bottom: 0;
    }

    .checkboxGroup {
        display: inline-block;
        padding: 7px 10px;
    }
    </style>
</head>

<body class="fixed-navbar fixed-sidebar fixed-footer">
<g:include view="layouts/navCommon.gsp"/>

<div id="wrapper">
    <g:layoutBody/>
</div>

<div class="modal fade" id="rejectReason" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <g:form class="form-horizontal myform" controller="estate" action="reject">
                <input type="hidden" name="collateral.id" value="${this.collateral?.id}">

                <div class="color-line"></div>

                <div class="modal-header">
                    <h4 class="modal-title">返回原因</h4>
                </div>

                <div class="modal-body">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">返回原因</label>
                        <div class="col-sm-10">
                            <g:textArea class="form-control" id="comment" name="comment" value="" rows="6"/>
                        </div>
                    </div>
                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary confirmBtn1">保存</button>
                </div>
            </g:form>
        </div>
    </div>
</div>

<div class="modal fade" id="rejectReason3" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <g:form class="form-horizontal myform3" controller="abnormalMortgageBatch" action="reject">
                <input type="hidden" name="abnormalMortgageBatch.id" value="${this.abnormalMortgageBatch?.id}">

                <div class="color-line"></div>

                <div class="modal-header">
                    <h4 class="modal-title">返回原因</h4>
                </div>

                <div class="modal-body">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">返回原因</label>
                        <div class="col-sm-10">
                            <g:textArea class="form-control" id="comment3" name="comment" value="" rows="6"/>
                        </div>
                    </div>
                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary confirmBtn3">保存</button>
                </div>
            </g:form>
        </div>
    </div>
</div>

<div class="modal fade" id="failedReason" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <g:form class="form-horizontal myform2" controller="estate" action="changeCollateralStatus">
                <input type="hidden" name="collateral.id" value="${this.collateral?.id}">

                <div class="color-line"></div>

                <div class="modal-header">
                    <h4 class="modal-title">失败原因</h4>
                </div>

                <div class="modal-body">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">失败原因</label>
                        <div class="col-sm-10">
                            <g:textArea class="form-control" name="descriptionOfFailure" value="${this?.collateral?.descriptionOfFailure}" rows="6"/>
                        </div>
                    </div>
                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary confirmBtn2">保存</button>
                </div>
            </g:form>
        </div>
    </div>
</div>

<div class="modal fade" id="failedReason4" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <g:form class="form-horizontal myform4" controller="abnormalMortgageBatch" action="changeStatus">
                <input type="hidden" name="abnormalMortgageBatch.id" value="${this.abnormalMortgageBatch?.id}">

                <div class="color-line"></div>

                <div class="modal-header">
                    <h4 class="modal-title">失败原因</h4>
                </div>

                <div class="modal-body">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">失败原因</label>
                        <div class="col-sm-10">
                            <g:textArea class="form-control" name="descriptionOfFailure" name="descriptionOfFailure4" value="${this?.abnormalMortgageBatch?.descriptionOfFailure}" rows="6"/>
                        </div>
                    </div>
                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary confirmBtn4">保存</button>
                </div>
            </g:form>
        </div>
    </div>
</div>

<g:include view="layouts/navCommon1.gsp"></g:include>

<footer class="footer" style="text-align: center;left: 0px">
    <g:if test="${com.cindata.User.findById(session.SPRING_SECURITY_CONTEXT.authentication.principal.id)?.isYC()}">
        2017${com.cindata.DateUtilService.showCurrentYear()} © 重庆中科云丛科技有限公司
    </g:if>
    <g:else>
        2017${com.cindata.DateUtilService.showCurrentYear()} © 北京国信达数据技术有限公司
    </g:else>
</footer>
<asset:javascript src="homer/vendor/bootstrap/dist/js/bootstrap.min.js" />
<asset:javascript src="homer/vendor/datepicker/bootstrap-datepicker.min.js" />
<asset:javascript src="homer/vendor/datepicker/bootstrap-datepicker.zh-CN.min.js" />
<asset:javascript src="homer/vendor/datetimepicker/bootstrap-datetimepicker.min.js" />
<asset:javascript src="homer/vendor/metisMenu/metisMenu.min.js" />
<asset:javascript src="homer/vendor/sweetalert/lib/sweet-alert.min.js" />
<asset:javascript src="homer/vendor/toastr/toastr.min.js"/>
<asset:javascript src="homer/vendor/select2-3.5.2/select2.min.js" />
<asset:javascript src="homer/vendor/select2-3.5.2/select2_locale_zh-CN.js" />
<asset:javascript src="homer/vendor/iCheck/icheck.min.js" />
<asset:javascript src="homer/vendor/footable/footable.all.min.js" />
<asset:javascript src="homer/vendor/toastr/toastr.min.js"/>
<asset:javascript src="homer/homer.js" />
<asset:javascript src="common/common.js" />
<asset:javascript src="homer/vendor/ladda/dist/spin.min.js" />
<asset:javascript src="homer/vendor/ladda/dist/ladda.min.js" />
<asset:javascript src="homer/vendor/ladda/dist/ladda.jquery.min.js" />


%{--  <asset:javascript src="echarts/api?v=2.0&ak=ZUONbpqGBsYGXNIYHicvbAbM" />--}%

<asset:javascript src="echarts/echarts.js" />

<script>
    $(function() {

        function formatName(name) {
          if (typeof name == 'number') {
              name = name.toString();
          }
          return name.substr(0, 1) + '*';
        }

        var arr2 = $(".nameFormat a")
        if(arr2.length > 0){
            $.each($(".nameFormat a"), function (i, obj) {
                if ($(obj).text().trim()) {
                    $(obj).text(formatName($(obj).text().trim()));
                }
            });
        }else{
            $.each($(".nameFormat"), function (i, obj) {
                if ($(obj).text().trim()) {
                    $(obj).text(formatName($(obj).text().trim()));
                }

            });
        }


        function formatCertificate(certificate) {
          if (certificate.length > 12) {
            return certificate.substr(0, 12) + '******';
          }
          else
          {
            return certificate;
          }
        }

        $.each($(".certificateFormat"), function (i, obj) {
            if ($(obj).text().trim()) {
                $(obj).text(formatCertificate($(obj).text().trim()));
            }
        });


        function formatCellphone(cellphone) {
            if (typeof cellphone == 'number') {
                cellphone = cellphone.toString();
            }
            return cellphone.substr(0, 3) + '****' + cellphone.substr(7, 11);
        }

        $.each($(".cellphoneFormat"), function (i, obj) {
            if ($(obj).text().trim()) {
                $(obj).text(formatCellphone($(obj).text().trim()));
            }
        });
        $.each($(".cellphoneFormat2"), function (i, obj) {
            if ($(obj).val().trim()) {
                $(obj).val(formatCellphone($(obj).val().trim()));
            }

        });


        // Initialize metsiMenu plugin to sidebar menu
        $('#side-menu').metisMenu();

        // Initialize iCheck plugin
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green'
        });
        //        折叠
        $(".collapsed .showhide").click(function() {
            $(this).parent().parent().toggleClass("hbuilt");
            $(this).parent().parent().parent().toggleClass("panel-collapse");
        });
        $("select").select2();
        $('.form_datetime').datetimepicker({
            minView: "day",
            //选择日期后，不会再跳转去选择时分秒
            format: "yyyy-mm-dd hh:00:00",
            //选择日期后，文本框显示的日期格式
            language: 'zh-CN',
            //汉化
            autoclose: true //选择日期后自动关闭
        });

        //删除数据
        $(document).delegate(".deleteBtn", "click",
            function() {
                var currentForm = $(this).parent("form");
                swal({
                        title: "您确认删除该数据吗?",
                        type: "warning",
                        showCancelButton: true,
                        confirmButtonColor: "#DD6B55",
                        cancelButtonText: "取消",
                        confirmButtonText: "删除",
                        closeOnConfirm: false,
                        closeOnCancel: true

                    },
                    function(isConfirm) {
                        if (isConfirm) {
                            currentForm.submit();

                        }
                    });
            });

        // 确认失败
        $(document).delegate(".confirmBtn2", "click",
            function() {
                var descriptionOfFailure = $("#descriptionOfFailure").val();
                if (!descriptionOfFailure)
                {
                    toastr.error('请填写失败原因！');
                    return
                }
                swal({
                    title: "是否确认提交吗?",
                    type: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3aa9dd",
                    cancelButtonText: "取消",
                    confirmButtonText: "确认",
                    closeOnConfirm: false,
                    closeOnCancel: true
                },
                function(isConfirm) {
                    if (isConfirm) {
                        $(".myform2").submit();
                        swal("提交成功！", "", "success");
                    }
                });
            });

            // 不良资产确认失败
            $(document).delegate(".confirmBtn4", "click",
                function() {
                    var descriptionOfFailure = $(this).closest("form").find("textArea").val();
                    if (!descriptionOfFailure)
                    {
                        toastr.error('请填写失败原因！');
                        return
                    }
                    swal({
                        title: "是否确认提交吗?",
                        type: "warning",
                        showCancelButton: true,
                        confirmButtonColor: "#3aa9dd",
                        cancelButtonText: "取消",
                        confirmButtonText: "确认",
                        closeOnConfirm: false,
                        closeOnCancel: true
                    },
                    function(isConfirm) {
                        if (isConfirm) {
                            $(".myform4").submit();
                            swal("提交成功！", "", "success");
                        }
                    });
                });

        // 确认拒绝
        $(document).delegate(".confirmBtn1", "click",
            function() {
                var comment = $("#comment").val();
                if (!comment)
                {
                    toastr.error('请填写返回原因！');
                    return
                }
                swal({
                    title: "是否确认提交吗?",
                    type: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3aa9dd",
                    cancelButtonText: "取消",
                    confirmButtonText: "确认",
                    closeOnConfirm: false,
                    closeOnCancel: true
                },
                function(isConfirm) {
                    if (isConfirm) {
                        $(".myform").submit();
                        swal("提交成功！", "", "success");
                    }
                });
            });

            // 不良资产确认拒绝
            $(document).delegate(".confirmBtn3", "click",
                function() {
                    var comment = $(this).closest("form").find("textArea").val();
                    if (!comment)
                    {
                        toastr.error('请填写返回原因！');
                        return
                    }
                    swal({
                        title: "是否确认提交吗?",
                        type: "warning",
                        showCancelButton: true,
                        confirmButtonColor: "#3aa9dd",
                        cancelButtonText: "取消",
                        confirmButtonText: "确认",
                        closeOnConfirm: false,
                        closeOnCancel: true
                    },
                    function(isConfirm) {
                        if (isConfirm) {
                            $(".myform3").submit();
                            swal("提交成功！", "", "success");
                        }
                    });
                });


        // 确认
        $(document).delegate(".confirmBtn", "click",
            function() {
                var currentForm = $(this).parent("form");
                swal({
                    title: "是否确认提交吗?",
                    type: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3aa9dd",
                    cancelButtonText: "取消",
                    confirmButtonText: "确认",
                    closeOnConfirm: false,
                    closeOnCancel: true
                },
                function(isConfirm) {
                    if (isConfirm) {
                        currentForm.submit();
                        // swal("提交成功！", "", "success");
                    }
                });
            });

        $('#citySelect').change(function() {
            var currentCity = $('#citySelect').val()
            //                alert(currentCity)
            // 写入session
            $.ajax({
                type: "POST",
                url: "/login/currentCity",
                data: {
                    city: currentCity
                },
                success: function(msg) {
                    if (window.location.pathname.indexOf('/estate/searchEstate') >= 0) {
                        location.replace("/estate/searchEstate")
                    }
                }
            })
            //如果是搜索页面 刷新页面

            //如果是主页
            //            if(window.location.pathname.indexOf('/main/index')>=0){
            //                initCloum(currentCity)
            ////                initMap(1,currentCity)
            //                initStatics(currentCity)
            //            }
        })

    });
    // 限制输入框数值大小
    function text(){
        if(buildAreaStart.value<0||buildAreaStart.value>214748||buildAreaEnd.value<0||buildAreaEnd.value>214748){
            toastr.error('值应0-214748之间');
            buildAreaStart.value='';
            buildAreaEnd.value='';
            return false;
        }
    }
    // 限制输入框数值大小

    function text1(){
        if(loansAmountStart.value<0||loansAmountStart.value>214748||loansAmountEnd.value<0||loansAmountEnd.value>214748||loansBalanceEnd.value<0||loansBalanceEnd.value>214748
            ||loansBalanceStart.value<0||loansBalanceStart.value>214748){
            toastr.error('值应0-214748之间');
            loansAmountStart.value ='';
            loansAmountEnd.value='';
            loansBalanceStart.value='';
            loansBalanceEnd.value='';
            return false;
        }
    }

    var currentUrl = window.location.href;
    if (currentUrl.indexOf('heatIndex') != "-1")
    {
        // 首页弹出预警弹窗
        $("#right-sidebar").addClass("sidebar-open");
    }
    else
    {
         $("#right-sidebar").removeClass("sidebar-open");
    }

    $.ajax({
        type: "POST",
        url: "/main/getPendingCounts",
        data: {},
        success: function(data) {
            $(".antiFraudCount").text(data.antiFraudCount);
            $(".estatePendingCount").text(data.estatePendingCount);
            $(".contactWarningCount").text(data.contactWarningCount);
            $(".priceFluctuationsRatioCount").text(data.priceFluctuationsRatioCount);
            $(".concentrationCount").text(data.concentrationCount);
            $(".buildingScoreCount").text(data.buildingScoreCount);
            $(".collateralCoverageRateCount").text(data.collateralCoverageRateCount);
            $(".effectiveMaturityCount").text(data.effectiveMaturityCount);
        }
    })

    // 错误信息弹出框的参数配置
    toastr.options = {
        "closeButton": true,
        "debug": false,
        "newestOnTop": false,
        "progressBar": false,
        "positionClass": "toast-top-center",
        "preventDuplicates": false,
        "onclick": null,
        "showDuration": "300",
        "hideDuration": "1000",
        "timeOut": "3000",
        "extendedTimeOut": "1000",
        "showEasing": "swing",
        "hideEasing": "linear",
        "showMethod": "fadeIn",
        "hideMethod": "fadeOut"
    };
</script>

%{--一键换肤--}%
<script>
    $(document).ready(function () {
        var skin = $("#skin").val()
        if (skin == 0)
        {
            $("#skin1").attr("href","/assets/homer/style.css?"+Math.random())
            $(".imageTabs").attr("src","/assets/pls_logo1.png")
        }
        if (skin == 1)
        {
            $("#skin1").attr("href","/assets/homer/style111.css?"+Math.random())
            $(".imageTabs").attr("src","/assets/pls_logo11.png")
        }

        $(".circle1").click(function () {
            changeSkin(0);

        })
        $(".circle2").click(function () {
            changeSkin(1);
        })

        function changeSkin(skin)
        {
            $.ajax({
                type: "post",
                url: "/user/changeSkin",
                data:{
                    skin: skin
                },
                success: function (data) {
                    if (data.status == "success") {
                        window.location.reload()
                    }
                },
                error: function () {
                    console.log("获取失败，请稍后重试");
                },
            });
        }
    });

</script>

</body>

</html>
